Skip to content

feat: add ColorDescription::with_full_range and is_hdr - #30

Merged
hgaiser merged 1 commit into
hgaiser:mainfrom
lutyjj:feat/color-description-api
Aug 2, 2026
Merged

feat: add ColorDescription::with_full_range and is_hdr#30
hgaiser merged 1 commit into
hgaiser:mainfrom
lutyjj:feat/color-description-api

Conversation

@lutyjj

@lutyjj lutyjj commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Continuation of the hgaiser/moonshine#146 review. Implements builder-style with_full_range for ColorDescription to avoid struct-update syntax at every call site. Also makes ColorDescription #[must_use] to catch a discarded builder result - on a Copy type that's a silent no-op. Additionally adds is_hdr as per request - replaces the "PQ transfer function is what makes the stream HDR" check that consumers keep redefining. Also replaces magic numbers with a little bit more readable constants.

Verified against moonshine: reworked the 7 sites from hgaiser/moonshine#146 on top of this and the whole thing compiles just fine.

From the hgaiser/moonshine#146 review. The presets pin primaries,
transfer and matrix as a group, and full range is the only field that
changes on its own, so every consumer ends up writing
`ColorDescription { full_range, ..ColorDescription::bt2020_pq() }`.
`with_full_range` gives that the same shape as the EncodeConfig
builders, and ColorDescription is `#[must_use]` now like the other
builder types. `is_hdr` moves the "PQ transfer function is what makes
the stream HDR" check onto the type instead of every consumer redefining
it; the luma range and primaries don't decide it. The H.273 code points
the presets use are named constants now instead of bare numbers.
@lutyjj
lutyjj force-pushed the feat/color-description-api branch from 2af716a to 0c14370 Compare August 2, 2026 09:33
lutyjj added a commit to lutyjj/pixelforge that referenced this pull request Aug 2, 2026
Integration branch for the local moonshine build:
  - feat/color-description-api (hgaiser#30)
  - fix/av1-keyframe-rc-reset (not yet submitted upstream)
@hgaiser

hgaiser commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Perfect, thanks 👍

@hgaiser
hgaiser merged commit 9d9934c into hgaiser:main Aug 2, 2026
7 checks passed
@lutyjj
lutyjj deleted the feat/color-description-api branch August 2, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants